package com.ym.script.util;

import java.util.LinkedList;
import java.util.List;


public class Shell {
	public String exec(String command) {
		StringBuffer result = new StringBuffer();
		RootUtil root = new RootUtil();
		if (root.startShell()) {
			List<String> output = new LinkedList<String>();
			root.execute(command, output);
			if (output != null) {
				for (String line : output) {
					result.append(line);
					result.append("\n");
				}
			}
		}
		root.dispose();
		return result.toString();
	}
}
